#include <iostream>

class Complex {
	private:
		double R;
		double M;

	public:
		Complex(double r = 0.0, double i = 0.0) : R(r), M(i) {}
		void display() const {
			std::cout << R << " + " << M << "i" << std::endl;
		}
		Complex operator+(const Complex &other) const {
			return {R + other.R, M + other.M};
		}
		Complex operator-(const Complex &other) const {
			return {R - other.R, M - other.M};
		}
		friend std::ostream &operator<<(std::ostream &os, const Complex &c) {
			os << c.R << " + " << c.M << "i";
			return os;
		}
};

int main() {
	Complex num1(2, 5);
	Complex num2(3, 4);

	Complex num3 = num1 + num2;
	std::cout << "Using operator+: " << num3 << std::endl;

	Complex num4 = num1 - num2;
	std::cout << "Using operator-: " << num4 << std::endl;

	return 0;
}